<link rel="stylesheet" href="/Static/mobile/vant/index.css">
<script src="/Static/mobile/vant/vue.min.js"></script>
<script src="/Static/mobile/vant/vant.min.js"></script>
<div id="app">
    <form id="form" method="POST" class="page">
        <h2 style="padding:20px 15px 15px;color:rgba(69,90,100,.6);">个人信息</h2>
        <van-cell-group>
            <input type="hidden" v-model="form.code_id"/>
            <van-field name="realname" v-model="form.realname" required  label="姓名" placeholder="请输入姓名"></van-field>
            <van-field name="mobile" v-model="form.mobile" required  label="手机号" placeholder="请输入手机号"></van-field>
            <van-field
                name="code"
                v-model="form.code"
                center required 
                label="短信验证码"
                placeholder="请输入短信验证码"
            >
                <van-button @click="sendsms" tag="a" slot="button" size="small" type="primary">
                    {{sendText}}
                    <span v-if="sendNum!=0">{{sendNum}}</span>
                </van-button>
            </van-field>

            <van-field name="pay_password" v-model="form.pay_password" required  label="支付密码" placeholder="请输入支付密码"></van-field>
            <van-field name="pay_password_confirm" v-model="form.pay_password_confirm" required  label="确认密码" placeholder="请输入支付密码"></van-field>

            <van-field name="idcard" v-model="form.idcard" required  label="身份证" placeholder="请输入身份证"></van-field>

     

            <van-field name="refer_uid" v-model="form.refer_uid"   label="推荐人ID" placeholder="请输入推荐人ID"></van-field>
        </van-cell-group>

       <!--  <h2 style="padding:20px 15px 15px;color:rgba(69,90,100,.6);">地址信息</h2>
        <van-cell-group>
            <van-cell is-link>
                <template slot="title">
                    <span class="van-cell-text">省</span>
                </template>
                <template>
                    <select style="width:100%;" id="province" name="user_province">
                    </select>
                </template>
            </van-cell>
            <van-cell is-link>
                <template slot="title">
                    <span class="van-cell-text">市</span>
                </template>
                <template>
                    <select style="width:100%;" id="city" name="user_city">
                    </select>
                </template>
            </van-cell>
            <van-cell is-link>
                <template slot="title">
                    <span class="van-cell-text">区/县</span>
                </template>
                <template>
                    <select style="width:100%;" id="county" name="user_county">
                    </select>
                </template>
            </van-cell>
        </van-cell-group> -->

    </form>

    <div style="width:90%;margin:1em auto;">
        <van-button onclick="AjaxFormSubmit()" block type="primary" size="normal">提交注册</van-button>
    </div>
</div>

<div style="width:100%;white-space:normal;padding:20px 15px;box-sizing: border-box;">
    <p>
        温馨提示
    </p>
    <p>
        1、请您准确填写注册信息，并保管好账号和密码。
    </p>
    <p>
        2、您的注册信息长期有效，今后登录系统时无需再次注册。
    </p>
    <p>
        3、您可随时登录本系统，了解有关信息。
    </p>
    <p>
        4、因提现需要姓名、手机号、身份证号必须真实有效，且注册后不可更改
    </p>
    <p>
        5：注册成功后登录账号为手机号，登录密码为身份证后六位
    </p>
    <p>
        祝您工作顺利并取得好成绩！
    </p>
</div>
<script src="__STATIC__mobile/js/areadata.js"></script>
<script src="__STATIC__mobile/js/myarea.js"></script>
<script>

    var app = new Vue({
        el: '#app',
        data: {
            form: {
                grade_name: 1,
                refer_uid: '<?=get("refer")?>'
            },
            showPicker: true,
            gradearr: JSON.parse('<?=json_encode($gradearr)?>'),
            sendText: '发送验证码',
            sendNum: 0
        },
        watch: {
            sendNum: function (val,oldval) {
                if(val!=0) {
                    this.sendText = '已发送';
                }else{
                    this.sendText = '发送验证码';
                    clearInterval(window.sendTask);
                }
            }
        },
        mounted: function () {
            city.getcity('province', 'city', 'county', '', '', '', 1);
        },
        methods: {
            sendsms: function () {
                if(this.sendText!='发送验证码') {
                    return false;
                }
                var self = this;
                $.get('/mobile/login/sendsms?mobile='+this.form.mobile).then(function(res){
                    if(res.ret==1) {
                        showerror(res.msg);
                    }else{
                        self.sendNum = 60;
                        self.form['code_id'] = res.data;
                        window.sendTask = setInterval(function(){
                            self.sendNum--;
                        },1000)
                    }
                })
            }
        }
    })
</script>
<style>
    .van-cell__title {
        max-width: 90px;
    }

    .van-cell__value {
        text-align: left;
    }
</style>